package com.greenantmall.view;

import android.app.Activity;
import android.app.Dialog;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.greenantmall.R;

public class PortalNoticeDialog extends Dialog implements android.view.View.OnClickListener {
	private TextView mTvNoticeContent;
	private TextView mBtnClose;
	
	public PortalNoticeDialog(Activity activity, String notice) {
		super(activity, R.style.portal_notice_dialog_style);
		setContentView(R.layout.portal_notice_dialog);
		
		mTvNoticeContent = (TextView)findViewById(R.id.portal_notice_dialog_content);
		mBtnClose = (TextView)findViewById(R.id.portal_notice_dialog_close);
		
		mTvNoticeContent.setText(notice);
		mBtnClose.setOnClickListener(this);
		
		DisplayMetrics dm = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
		WindowManager.LayoutParams lp = getWindow().getAttributes();
		lp.width = dm.widthPixels;
		lp.height = dm.heightPixels;
		getWindow().setAttributes(lp);
	}

	@Override
	public void onClick(View v) {
		if(v.equals(mBtnClose)) {
			this.dismiss();
		}
	}
}















